package app.vendorportal;

import core.framework.cache.CacheProvider;
import core.framework.cache.CacheRegistry;
import core.framework.cache.CacheSettings;
import core.framework.cache.DefaultCacheConfig;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;

import javax.inject.Inject;

@Configuration
public class CacheConfig extends DefaultCacheConfig {
    @Inject
    Environment env;

    @Override
    public CacheSettings cacheSettings() {
        CacheSettings settings = new CacheSettings();
        settings.setCacheProvider(env.getProperty("cache.provider", CacheProvider.class, CacheProvider.LOCAL));
        settings.setRemoteCacheServer(env.getProperty("cache.remoteCacheServers"));
        return settings;
    }

    @Override
    protected void addCaches(CacheRegistry registry) {
        //CacheConstants.addCommonCache(registry);
    }
}
